home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / Intrinsics.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-23  |  3.8 KB  |  86 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3.     Intrinsics.h
  4.     
  5.     Copyright Apple Computer,Inc.  1996
  6.     All rights reserved
  7.  
  8.     Instruction intrinsics are pseudo-functions which may be expanded  
  9.     inline by the compiler to provide direct access to selected PowerPC 
  10.     machine instructions.  If compiler support is not provided for inline
  11.     expansion then references to these functions will generate external 
  12.     function references.  MrC[pp] versions 2.0 and later recognize the
  13.     intrinsics and perform inlining but earlier versions of MrC do not.
  14.     
  15.     With exceptions noted below, the function's name and prototype follow 
  16.     from the machine instruction's name and operands.  The function return 
  17.     value corresponds to the instruction's destination operand, e.g. FABS; 
  18.     the function returns void if there is no destination operand, e.g. STHBRX.  
  19.     The function's arguments agree in number and correspond with the
  20.     instruction's source operands.  The correspondence is also shown by 
  21.     the function argument names in relation to the instruction template 
  22.     in the comment next to each function.
  23.  
  24.     The PowerPC architecture manuals describe these instructions in detail.
  25.     
  26.     Naming exception: __setflm does not correspond to a machine instruction.
  27.     It uses two instructions, MFFS and MTFSF, to store the low 32 bits of 
  28.     its double argument into FPSCR and return the previous value of FPSCR 
  29.     in the low 32 bits of its return value.
  30.     
  31. ************************************************************/
  32.  
  33. #ifndef __INTRINSICS__
  34. #define __INTRINSICS__
  35.  
  36. #include <ConditionalMacros.h>
  37.  
  38. #if        GENERATINGPOWERPC
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43.  
  44. int __cntlzw (unsigned int rS);                        /* CNTLZW    rA,rS */
  45. void __dcbf (void * rA, int rB);                    /* DCBF        rA,rB */
  46. void __dcbt (void *rA, int rB);                        /* DCBT        rA,rB */
  47. void __dcbst (void *rA, int rB);                    /* DCBST    rA,rB */
  48. void __dcbtst (void *rA, int rB);                    /* DCBTST    rA,rB */
  49. void __dcbz (void *rA, int rB);                        /* DCBZ        rA,rB */
  50. void __eieio (void);                                /* EIEIO */
  51. double __fabs (double frB);                            /* FABS        frD,frB */
  52. double __fmadd (double frA,double frC,double frB);    /* FMADD    frD,frA,frC,frB */
  53. double __fmsub (double frA,double frC,double frB);    /* FMSUB    frD,frA,frC,frB */    
  54. double __fnabs (double);                            /* FNABS    frD,frB */
  55. double __fnmadd(double frA,double frC,double frB);    /* FNMADD    frD,frA,frC,frB */
  56. double __fnmsub(double frA,double frC,double frB);    /* FNMSUB    frD,frA,frC,frB */
  57. float __fmadds(float frA,float frC,float frB);        /* FMADDS    frD,frA,frC,frB */
  58. float __fmsubs(float frA,float frC,float frB);        /* FMSUBS    frD,frA,frC,frB */
  59. float __fnmadds(float frA,float frC,float frB);        /* FNMADDS    frD,frA,frC,frB */
  60. float __fnmsubs(float frA,float frC,float frB);        /* FNMSUBS    frD,frA,frC,frB */
  61. double __frsqrte (double frB);                        /* FRSQRTE    frD,frB */ 
  62. float __fres (float frB);                            /* FRES        frD,frB */
  63. double __fsel (double frA,double frC,double frB);    /* FSEL        frD,frA,frC,frB */
  64. double __fsqrt (double frB);                        /* FSQRT    frD,frB */
  65. float __fsqrts (float frB);                            /* FSQRTS    frD,frB */
  66. void __icbi (void *rA, int rB);                        /* ICBI        rA,rB */
  67. void __isync (void);                                /* ISYNC */
  68. unsigned int __lhbrx (void *rA, int rB);            /* LHBRX    rD,rA,rB */
  69. unsigned int __lwbrx (void *rA, int rB);            /* LWBRX    rD,rA,rB */
  70. double __mffs (void);                                /* MFFS        frD */
  71. unsigned int __mfxer(void);                            /* MFSPR    rD,1 */
  72. int __mulhw (int rA, int rB);                        /* MULHW    rD,rA,rB */
  73. unsigned int __mulhwu (unsigned int rA, unsigned int rB);    /* MULHWU    rD,rA,rB */
  74. double __setflm (double frB);                        /* MFFS    frD; MTFSF 255,frB */
  75. void __sthbrx (unsigned short rS, void *rA, int rB);/* STHBRX    rS,rA,rB */
  76. void __stwbrx (unsigned int rS, void *rA, int rB);    /* STWBRX    rS,rA,rB */
  77. void __sync (void);                                    /* SYNC */
  78.  
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82.  
  83. #endif    /* GENERATINGPOWERPC */
  84.  
  85. #endif /* __INTRINSICS__ */
  86.